package com.stylefeng.guns.modular.vpn_apple_control.controller;

import com.stylefeng.guns.core.base.controller.BaseController;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.beans.factory.annotation.Autowired;
import com.stylefeng.guns.core.log.LogObjectHolder;
import org.springframework.web.bind.annotation.RequestParam;
import com.stylefeng.guns.modular.vpn_apple_control.service.IVpnAddMenuService;

/**
 * Apple上线管理控制器
 *
 * @author fengshuonan
 * @Date 2020-04-27 14:53:49
 */
@Controller
@RequestMapping("/vpnAppleReleaseControl")
public class VpnAppleReleaseControlController extends BaseController {

    private String PREFIX = "/vpn_apple_control/vpnAppleReleaseControl/";

    @Autowired
    private IVpnAddMenuService vpnAddMenuService;

    /**
     * 跳转到Apple上线管理首页
     */
    @RequestMapping("")
    public String index() {
        return PREFIX + "vpnAppleReleaseControl.html";
    }

    /**
     * 跳转到添加Apple上线管理
     */
    @RequestMapping("/vpnAppleReleaseControl_add")
    public String vpnAddMenuAdd() {
        return PREFIX + "vpnAddMenu_add.html";
    }

    /**
     * 获取Apple上线管理列表
     */
    @RequestMapping(value = "/list")
    @ResponseBody
    public Object list() {
        return vpnAddMenuService.getAppleReleaseControl();
    }

    /**
     * 修改Apple上线管理
     */
    @RequestMapping(value = "/updateRedisKey")
    @ResponseBody
    public Object update(@RequestParam("redisKey") String redisKey,
                         @RequestParam("value") String value) {
        vpnAddMenuService.setAppleReleaseControl(redisKey,value);
        return SUCCESS_TIP;
    }

}
